/// @tags: K-D Tree
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <queue>
using std::max;
using std::min;

namespace BlueQuantum {

typedef long long ll;

int const N = 1e5 + 5;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

struct Node {
  ll dis;
  int id;
  Node(ll dis, int id) : dis(dis), id(id) {}
  inline bool operator<(Node const &rhs) const {
    return dis > rhs.dis || (dis == rhs.dis && id < rhs.id);
  }
};

struct Point {
  static int dim;
  int x[2], id;
  inline bool operator<(Point const &rhs) const { return x[dim] < rhs.x[dim]; }
} p[N];

struct TreeNode {
  Point p;
  int mx[2], mn[2], ls, rs;
} tr[N];

int n, m, tot, root, X, Y, Point::dim;
std::priority_queue<Node> pq;

inline ll dis(TreeNode const &x) {
  return 1ll * (x.p.x[0] - X) * (x.p.x[0] - X) + 1ll * (x.p.x[1] - Y) * (x.p.x[1] - Y);
}

inline ll mxdis(TreeNode const &x) {
  ll P = 1ll * (x.mn[0] - X) * (x.mn[0] - X);
  ll M = 1ll * (x.mx[0] - X) * (x.mx[0] - X);
  ll Q = 1ll * (x.mn[1] - Y) * (x.mn[1] - Y);
  ll N = 1ll * (x.mx[1] - Y) * (x.mx[1] - Y);
  return max(P, M) + max(Q, N);
}

inline void update(int x) {
  if (!x) return;
  int l = tr[x].ls, r = tr[x].rs;
  if (l)
    tr[x].mn[0] = min(tr[x].mn[0], tr[l].mn[0]),
    tr[x].mn[1] = min(tr[x].mn[1], tr[l].mn[1]),
    tr[x].mx[0] = max(tr[x].mx[0], tr[l].mx[0]),
    tr[x].mx[1] = max(tr[x].mx[1], tr[l].mx[1]);
  if (r)
    tr[x].mn[0] = min(tr[x].mn[0], tr[r].mn[0]),
    tr[x].mn[1] = min(tr[x].mn[1], tr[r].mn[1]),
    tr[x].mx[0] = max(tr[x].mx[0], tr[r].mx[0]),
    tr[x].mx[1] = max(tr[x].mx[1], tr[r].mx[1]);
}

inline void query(int x) {
  if (!x) return;
  ll res = dis(tr[x]);
  if (res > pq.top().dis || (res == pq.top().dis && tr[x].p.id < pq.top().id))
    pq.pop(), pq.push(Node(res, tr[x].p.id));
  ll l = tr[x].ls, r = tr[x].rs, ld, rd;
  if (l) ld = mxdis(tr[l]);
  if (r) rd = mxdis(tr[r]);
  if (ld > rd) {
    if (ld >= pq.top().dis) query(l);
    if (rd >= pq.top().dis) query(r);
  } else {
    if (rd >= pq.top().dis) query(r);
    if (ld >= pq.top().dis) query(l);
  }
}

inline void build(int &x, int l, int r, int k) {
  if (l > r) return;
  x = ++tot;
  Point::dim = k;
  int mid = (l + r) >> 1;
  std::nth_element(p + l, p + mid, p + r + 1);
  tr[x].p = p[mid];
  tr[x].mn[0] = tr[x].mx[0] = tr[x].p.x[0];
  tr[x].mn[1] = tr[x].mx[1] = tr[x].p.x[1];
  build(tr[x].ls, l, mid - 1, k ^ 1);
  build(tr[x].rs, mid + 1, r, k ^ 1);
  update(x);
}

inline int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(p[i].x[0]), read(p[i].x[1]), p[i].id = i;
  build(root, 1, n, 0);
  read(m);
  for (int i = 1, k; i <= m; i++) {
    read(X), read(Y), read(k);
    while (!pq.empty()) pq.pop();
    for (int j = 1; j <= k; j++) pq.push(Node(-1, 0));
    query(root);
    printf("%d\n", pq.top().id);
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("K-DTree.in", "r", stdin);
  freopen("K-DTree.out", "w", stdout);
#endif
#endif

  return BlueQuantum::main();
}